package com.edgar.download;

import android.net.Uri;
import android.text.TextUtils;

import java.util.List;

/**
 * Created by xiexiang on 2015/11/1.
 */
public class UriUtils {

    public static String getUriLastSegment(String strUri){
        if(TextUtils.isEmpty(strUri)){
            return "";
        }
        Uri uri = Uri.parse(strUri);
        List<String> pathSegments = uri.getPathSegments();
        if(pathSegments == null) return "";
        int size = pathSegments.size();
        if(size > 0){
            return pathSegments.get(size-1);
        }
        return uri.getAuthority();
    }
}